Chapter 8\EmployeeDOM.htm

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>Employees</TITLE>

<SCRIPT LANGUAGE=javascript>
<!--
var xmlDoc;

function button1_onclick() 
{
	var xmlEmp = xmlDoc.documentElement.childNodes.item( 
		select1.selectedIndex );
	var xmlPos = xmlEmp.childNodes.item( 1 );
	var xmlPhone = xmlEmp.childNodes.item( 3 );

	position.innerText = xmlPos.text;
	phone.innerText = xmlPhone.childNodes.item(0).text;
}
//-->
</SCRIPT>
</HEAD>

<!-- This is where the data island used to be! -->

<BODY>

<!-- Put the employee names within 
	 the combo box.
-->
<H2>Select an employee</H2>
<SELECT id=select1 name=select1>
<SCRIPT LANGUAGE=javascript>
<!--
	xmlDoc = new ActiveXObject( "microsoft.xmldom" );
	xmlDoc.load( "EmployeesWithDTD.xml" );	

	var xmlRoot = xmlDoc.documentElement;
	var intTotal = xmlRoot.childNodes.length;
	var xmlEmp;
	var intCount;
	
	for ( intCount = 0;
		  intCount < intTotal;
		  intCount++ )
	{
		xmlEmp = xmlRoot.childNodes.item( intCount );
		document.write( "<OPTION>" );
		document.write( xmlEmp.childNodes.item(0).text );
		document.write( "</OPTION>" );
	}
//-->
</SCRIPT>
</SELECT>

<INPUT type="button" value="Go get it!" id=button1 name=button1 LANGUAGE=javascript onclick="return button1_onclick()">

<P>
<TABLE WIDTH=100%>
	<TR><TD WIDTH=10%><B>Position:</B>
	<TD><SPAN ID=position></SPAN>
	<TR><TD><B>Phone:</B>
	<TD><SPAN ID=phone></SPAN>
</TABLE>

</BODY>
</HTML>